Task Scheduler

You can use Task Scheduler to schedule commands, programs, or scripts to run at specific times.

  • For tips about using Task Scheduler, see Best practices.
  • For help with specific tasks, see How to.
  • For general background information, see Concepts.
  • For problem-solving instructions, see Troubleshooting.


Best practices

Set appropriate permissions on the file your scheduled task will run.

  • To avoid a malicious user from corrupting a program set to run by a scheduled task, restrict access for the program file to only the specific users who need access.
  • For more information about setting permissions on a file, see Set, view, change, or remove permissions on files and folders.

Make sure you have correct password information for your users.

  • Before creating a scheduled task, check that the account and password information you have for the user that you will enter in the Add Scheduled Task wizard or Run as box in the scheduled task's property dialog box is accurate. If an account password expires any scheduled task for which that user has been specified will not run. For more information, see Task Scheduler and security.

Encourage your users to use strong passwords.

  • Scheduled tasks always run under the context of a specific account, and the set of permissions for which the group it belongs to provides. To prevent a malicious user from modifying a scheduled task using another user's account name and password, encourage the use of strong passwords. For more information about strong passwords, see Strong passwords.

Choose carefully when deciding which tasks to schedule under the System account.

  • Tasks scheduled under the System (or AT Service account) will run regardless of which user is logged on to a computer. Often these tasks will run in the background, unnoticed by the user.

    For more information about the implications of running a task under the System account, see Act as part of the operating system.

Before stopping a scheduled task that is running, check for other scheduled tasks that are dependent on the task.

  • If you stop a scheduled task that is running without checking for dependent tasks, other tasks might not run or run incorrectly.

Only create scheduled tasks on domain controllers if absolutely necessary.

  • If you are a member of the Administrators group, and the local computer on which you create a scheduled task is a domain controller, the scheduled task could affect objects in the entire domain.

Avoid entering a member of the Domain Admins group in the Add Scheduled Task wizard or Run as box when creating a scheduled task.

  • It is possible that a malicious user who is a member of the Administrators group could obtain those credentials and access the entire domain.


How to...

  • Schedule tasks
  • Manage Task Scheduler


Schedule tasks

  • Schedule a new task
  • Modify a scheduled task
  • Remove a scheduled task
  • Stop a scheduled task that is running
  • Run a scheduled task immediately
  • Schedule a task on a remote computer


Schedule a new task

Microsoft Windows graphic

To schedule a new task

  1. Open Task Scheduler.
  2. Double-click Add Scheduled Task.
  3. Follow the instructions in the Scheduled Task wizard.

Notes

  • To perform this procedure, you must be a member of the Administrators, Backup Operators, or Server Operators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.
  • When creating a scheduled task, you must enter a user name and password, either in the Add Scheduled Task Wizard or in the Run as box in the Task tab of the scheduled task's property dialog box. When the scheduled task runs, the program you've scheduled runs as if it were started by the user you specified, with that user's security context.
  • XOX
  • Confirm that the system date and time on your computer are accurate, as Task Scheduler relies on this information to run scheduled tasks. To verify or change this information, double-click the time indicator on the taskbar.
  • If you want to configure advanced settings for the task, select the Open advanced properties for this task when I click Finish check box in the final page of the wizard. This opens the properties dialog box for the task. You can then change the program being run in the Task tab, fine-tune the schedule in the Schedule tab, customize settings in the Settings tab, or set user and group permissions in the Security tab.
  • If the task program requires command-line options, type them in Run, after the task path.
  • If the path to the task program includes spaces, type double quotation marks ("") around the entire task path. For example:

    • "C:\Program Files\Windows Media Player\Mplayer2.exe"

Related Topics


Modify a scheduled task

Microsoft Windows graphic

To modify a scheduled task

  1. Open Task Scheduler.
  2. Right-click the task you want to modify, and then click Properties.
  3. Do one or more of the following:
    • To change the program being run, in Run, type the path for the new program.
    • To change the user account name and password that the scheduled task will run as, edit or enter a new name in the Run as box, and then click Set password.
    • To change the schedule for the task, click the Schedule tab.
    • To customize the settings for the task, click the Settings tab.
    • To set user and group permissions for the task, click the Security tab.

Notes

  • To perform this procedure, you must be a member of the Administrators, Backup Operators, or Server Operators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.
  • XOX
  • Confirm that the System date and time on your computer are accurate, as Task Scheduler relies on this information to run scheduled tasks. To verify or change this information, double-click the time indicator on the taskbar.
  • If the task program requires command-line options, type them in Run, after the task path.
  • If the path to the task program includes spaces, type double quotation marks ("") around the entire task path. For example:

    • "C:\Program Files\Windows Media Player\Mplayer2.exe"


Remove a scheduled task

Microsoft Windows graphic

To remove a scheduled task

  1. Open Task Scheduler.
  2. Right-click the task that you want to remove, and then click Delete.

Notes

  • To perform this procedure, you must be a member of the Administrators, Backup Operators, or Server Operators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.
  • XOX
  • You can also remove a scheduled task by selecting a task in the details pane, and then clicking Delete on the File menu.
  • Removing a scheduled task removes only the .job file from the schedule. The program file the task runs is not removed from the hard disk.


Stop a scheduled task that is running

Microsoft Windows graphic

To stop a scheduled task that is running

  1. Open Task Scheduler.
  2. Click the task that you want to stop.
  3. From the File menu, click End Scheduled Task.

Notes

  • To perform this procedure, you must be a member of the Administrators, Backup Operators, or Server Operators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.
  • XOX
  • If you stop a scheduled task that is currently running, you might experience a delay (up to 3 minutes) before the task shuts down.
  • To restart a stopped task, right-click the task, and then click Run.

Note

  • Before stopping a scheduled task that is running, make sure you check for other scheduled tasks that are dependent on the task. If you stop a scheduled task that is running without checking what other tasks are dependent on it, other tasks might not run or run incorrectly.


Run a scheduled task immediately

Microsoft Windows graphic

To run a scheduled task immediately

  1. Open Task Scheduler.
  2. Right-click the task that you want to run, and then click Run.

Notes

  • To perform this procedure, you must be a member of the Administrators, Backup Operators, or Server Operators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.
  • XOX
  • You can also run a scheduled task immediately by selecting a task in the details pane, and then clicking Run on the File menu.


Schedule a task on a remote computer

Microsoft Windows graphic

To schedule a task on a remote computer

  1. Open My Network Places.
  2. Click Search for Computers.
  3. In the Computer name box, enter the computer name, and then click Search.
  4. In the details pane, double-click the remote computer on which you want to view scheduled tasks.
  5. Double-click Scheduled Tasks.
  6. On the File menu, point to New, and then click Scheduled Task.
  7. Type a name for the new task, and then press ENTER.
  8. Right-click the new task, and then click Properties.
  9. Do the following:
    • To specify the program being run, in Run, type the path for the new program.
    • To set the user account name and password that the scheduled task will run as, type a new name in Run as, and then click Set password.
    • To set the schedule for the task, click the Schedule tab.
    • To customize the settings for the task, click the Settings tab.
    • To set user and group permissions for the task, click the Security tab.

Notes

  • To perform this procedure, you must be a member of the Administrators group, or have been delegated the appropriate authority, on the remote computer. As a security best practice, consider using Run as to perform this procedure.
  • XOX


Manage Task Scheduler

  • Stop the Task Scheduler service
  • Restart the Task Scheduler service
  • Pause the Task Scheduler service
  • Receive notification of missed tasks
  • Set the AT Service Account
  • View a log of past scheduled tasks
  • Set power management options for a scheduled task
  • Configure Task Scheduler using Computer Management


Stop the Task Scheduler service

Microsoft Windows graphic

To stop the Task Scheduler service

  1. Open Task Scheduler.
  2. On the Advanced menu, click Stop Using Task Scheduler.

Notes

  • To perform this procedure, you must be a member of the Administrators or Server Operators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.
  • XOX
  • Tasks will not run at their scheduled times until you restart the Task Scheduler service.


Restart the Task Scheduler service

Microsoft Windows Graphic

To restart the Task Scheduler service

  1. Open Task Scheduler.
  2. On the Advanced menu, click Start Using Task Scheduler.

Notes

  • To perform this procedure, you must be a member of the Administrators or Server Operators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.
  • XOX


Pause the Task Scheduler service

Microsoft Windows graphic

To pause the Task Scheduler service

  1. Open Task Scheduler.

  2. On the Advanced menu, click Pause Task Scheduler.

Notes

  • To perform this procedure, you must be a member of the Administrators or Server Operators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.
  • XOX
  • The Pause Task Scheduler command is useful if you do not want scheduled tasks to run at the same time you are installing software or running another program (such as a game).
  • To resume the schedules for all tasks, on the Advanced menu, click Continue Task Scheduler. Once the service is restarted, tasks will run at their previously scheduled times.


Receive notification of missed tasks

Microsoft Windows graphic

To receive notification of missed tasks

  1. Open Task Scheduler.
  2. On the Advanced menu, click Notify Me of Missed Tasks.

Notes

  • To perform this procedure, you must be a member of the Administrators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.
  • If you enable the Notify Me of Missed Tasks setting, the missed tasks dialog box displays at the foreground of the computer display, in front of the logon screen, when there are missed tasks to report. Anyone who sits at the computer can view the list of missed tasks.
  • XOX
  • A check mark next to Notify Me of Missed Tasks indicates that the feature is turned on. You can click Notify Me of Missed Tasks again to clear the check mark and turn off the feature.


Set the AT Service Account

Microsoft Windows graphic

To set the AT Service Account

  1. Open Task Scheduler.
  2. On the Advanced menu, click AT Service Account.
  3. Click This Account, and then type the user account that will run tasks that are scheduled by using the at command.
  4. In the Password and Confirm Password boxes, type the password for the account.

Notes

  • To perform this procedure, you must be a member of the Administrators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.
  • XOX
  • The AT service account is used by tasks that have been scheduled by using the at command.
  • By default, tasks scheduled using the at command stop after 72 hours. For more information, see At in Related Topics.
  • Unless you click This Account and type the user account name and password, tasks are scheduled using System Account, which is the default selection in the AT Service Account Configuration dialog box. If you run the at command for tasks by using the System Account, the scheduled tasks run using the default System account.


View a log of past scheduled tasks

Microsoft Windows graphic

To view a log of past scheduled tasks

  1. Open Task Scheduler.
  2. On the Advanced menu, click View Log.

Notes

  • To perform this procedure, you must be a member of the Administrators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.
  • XOX
  • The Task Scheduler log file lists all past scheduled tasks under all users, including members of the Administrators group and the System account. The file is located in the \Windows\Tasks folder, and is named SchedLgU.txt. In the SchedLgU.txt file, to see the most recent task that has run, find the following text:
    [ ***** Most recent entry is above this line ***** ]. The most recent task that has run is the entry directly above this text.
  • The default log file size is 32 kilobytes.
  • When the log file reaches its maximum size, it automatically starts recording new information at the beginning of the log file and writes over old log file information.


Set power management options for a scheduled task

Microsoft Windows graphic

To set power management options for a scheduled task

  1. Open Task Scheduler.
  2. Right-click the task for which you want to set power management options, and then click Properties.
  3. On the Settings tab, under Power Management, do one or more of the following:
    • To conserve the battery power of your computer, select the Don't start the task if the computer is running on batteries check box.
    • To stop the task if the computer starts running on battery power, select the Stop the task if battery mode begins check box.
    • To wake your computer from hibernation or standby to run a task, select the Wake the computer to run this task check box.

Notes

  • To perform this procedure, you must be a member of the Administrators or Server Operators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.
  • XOX
  • By default, power management is set to refrain from starting scheduled tasks if the computer is running on battery power. If you are using a portable computer that runs on batteries and you want a scheduled task to run, clear the default check boxes.
  • If the power is interrupted or if the battery fails, the scheduled task that is running might not complete.
  • The Wake the computer to run this task check box is only displayed on computers that support it.


Configure Task Scheduler using Computer Management

Microsoft Windows Graphic

To configure Task Scheduler using Computer Management

  1. XOX
  2. In the console tree, click Services.

    Where?

    • Computer Management (Local)
    • Services and Applications
  3. In the details pane, double-click Task Scheduler.
  4. Edit the appropriate settings in the General, Log On, Recovery, or Dependencies tab.

Note

  • To perform this procedure, you must be a member of the Administrators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.


Concepts

This section provides general background information about Task Scheduler:

  • Task Scheduler overview
  • Task Scheduler and security
  • Administering Task Scheduler using Computer Management
  • Creating and managing scheduled tasks from the Command Line


Task Scheduler overview

Using Task Scheduler, you can schedule any script, program, or document to run at a time that is most convenient for you.

When you first install your Windows Server 2003 family operating system, the Task Scheduler service is enabled. By default, you must be a member of the Administrators, Backup Operators, or Server Operators group on the local computer, to view, add, edit, or delete scheduled tasks, or to disable, pause, or restart the Task Scheduler service. For more information see, Task Scheduler and Security.

With Task Scheduler, you can:

  • Schedule a task to run daily, weekly, monthly, or at certain times (such as system startup).
  • Change the schedule for a task.
  • Stop a scheduled task.
  • Customize how a task runs at a scheduled time.

Each scheduled task you create is stored as a .job file in the \Windows\Tasks folder. The .job file contains the properties and configuration information for the task. You can create a scheduled task on your computer and then drag the .job object over to a remote computer. After you drag a task from one computer to another, you must update the account information for the task before it will run. Removing a scheduled task removes only the .job file from the schedule. The program file the task runs is not removed from the hard disk.

For tips on using Task Scheduler, see Best Practices.


Task Scheduler and security

When creating a scheduled task, you must enter a user name and password, either in the Add Scheduled Task Wizard or in the Run as box in the Task tab of the scheduled task's property dialog box. When the scheduled task runs, the program you've scheduled runs as if it were started by the user you specified, with that user's security context. For example, if the user specified for a scheduled task is a member of the Backup Operators group on the local computer, the program specified in the scheduled task file runs as if a member of the Backup Operators group is logged onto the local computer. If another user is logged on to the computer at the time a scheduled task specified for a different user runs, the task runs but is not visible to the current user.

By default, to schedule a task, you must be a member of the Administrators, Backup Operators, or Server Operators group on the local computer. By default, when creating a scheduled task, you cannot enter a user who belongs to a group that has more rights than the group you belong to. For example, if you are a member of the Backup Operators group on the local computer, you cannot specify a member of the Administrators group when creating a scheduled task. However, a member of the Administrators group can enable a member of any group to create or modify scheduled tasks, by using the cacls command to modify the discretionary access control list (DACL) of the Tasks folder. By default, the Tasks folder is located in the \Windows folder on the hard drive of the local computer, for example C:\Windows\Tasks. For more information about using cacls, see Cacls.

Note

  • A user for whom you assign permissions to the Tasks folder using cacls will be able to access scheduled tasks for all users. Choose which users to give access to the Tasks folder judiciously.

In Windows Server 2003 family operating systems, passwords have an expiration date. If you are scheduling recurring tasks that run indefinitely, you need to be aware of the expiration date on your passwords. If the password changes for an account on a domain, then you must update the tasks scheduled to run under that account.

When a job is created through Task Scheduler, account information for all tasks that use the same run as account is stored only once. Task Scheduler validates the run as account when a job is created, which prevents incorrect run as account information from being saved and, as a result, prevents other existing jobs that use the same account from being affected. If the password validation fails, a job file is created, but it will not run.

If the run as account password has expired or the account has been deleted and recreated, the password must be updated for jobs to run. Updating the password for one job automatically updates it for all jobs that use the same run as account.

When you create a scheduled task, the user credentials you specify for that specific task are securely stored on the local computer.

For security-related tips on using Task Scheduler, see Best Practices.

Notes

  • To view the user and group permissions for a scheduled task, right-click the task, click Properties, and then click the Security tab.
  • To view or change advanced user and group permissions, on the Security tab, click Advanced, click the user for whom you want to view or change permissions, and then click View/Edit.
  • For information about viewing past scheduled tasks, see View a log of past scheduled tasks.
  • For general information about Task Scheduler, see Task Scheduler overview.


Administering Task Scheduler using Computer Management

Using Computer Management, you can do the following to a local or remote computer console:

  • Stop, start, or pause the Task Scheduler service
  • Specify start parameters for the Task Scheduler service
  • Specify logon settings for the Task Scheduler service
  • Select the computer's response if the Task Scheduler service fails
  • Set or verify dependencies for the Task Scheduler service

For more information, see Configure Task Scheduler using Computer Management.

Notes

  • XOX
  • The Task Scheduler Properties (computername) dialog box is in the Services snap-in. To make the dialog box available in MMC, you must add the Services snap-in to your Computer Management console.


Creating and managing scheduled tasks from the Command Line

In addition to using Task Scheduler, you can use the at and schtasks command-line utilities to create and manage scheduled tasks.

For more information about the at command, including all available parameters, see At. For more information about the schtasks command, including all available parameters, see Schtasks. For information about other command-line utilities, see Command-Line Reference.


Troubleshooting

What problem are you having?

Task does not run at the scheduled time.

Cause: The password for the user you specified when creating the scheduled task might have changed.

Solution: Open the scheduled task, and then update the password for the user.

Notes

  • XOX

See also: Modify a scheduled task; Schedule a new task; Task Scheduler and security; Best practices

or

Cause: The password for the user you specified when creating the scheduled task might be blank.

Solution: Assign a password for the user account for which you are scheduling the task. For more information, see User and group accounts. After the user has a password, modify the scheduled task to include the password.

Notes

  • XOX

See also: Modify a scheduled task; Schedule a new task; Task Scheduler and security; Best practices

or

Cause: Task Scheduler cannot find the executable for the program that is supposed to run at the scheduled time because the path to it is set incorrectly.

Solution:

  1. Open Task Scheduler.
  2. Double-click the scheduled task.
  3. In the Task tab, verify that the paths to the program executable are correct in the Run and Start in boxes.

Notes

  • To perform this procedure, you must be a member of the Administrators, Backup Operators, or Server Operators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.

See also: Best practices; Schedule a new task; Scheduling tasks from the Command Line; Configure Task Scheduler using Computer Management

or

Cause: The task was scheduled to run under another user account than the user currently logged on.

Solution:

  1. Open Task Scheduler.
  2. In the Task tab, in the Run as box, and then type the correct user name.

Notes

  • To perform this procedure, you must be a member of the Administrators, Backup Operators, or Server Operators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.

or

Cause: The Task Scheduler service might be stopped.

Solution:

  1. Open Task Scheduler.
  2. In the Advance menu, click Start Using Task Scheduler.

Notes

  • To perform this procedure, you must be a member of the Administrators or Server Operators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.

See also: Administering Task Scheduler using Computer Management

or

Cause: The Task Scheduler service might be disabled.

Solution:

  1. XOX
  2. In the console tree, click Services.

    Where?

    • Computer Management (Local)
    • Services and Applications
  3. In the details pane, double-click Task Scheduler.
  4. In the General tab, in Startup type list box, select Automatic or Manual. Click OK.

Notes

  • To perform this procedure, you must be a member of the Administrators or Server Operators group, or have been delegated the appropriate authority, on the local computer. As a security best practice, consider using Run as to perform this procedure.
  • You can also stop and start the Task Scheduler service in the Microsoft Management Console: open the Task Scheduler Properties (computername) dialog box, and then under the General tab, under Service status, click Start or Stop.

See also: Administering Task Scheduler using Computer Management